#ifndef UTILS_HPP_GUARD
#define UTILS_HPP_GUARD

#include "logger.hpp"

#include <string>
#include <map>
#include <vector>
#include <iostream>
#include <boost/foreach.hpp>

/**
 * code for printing vector, map and other need refactor
 *
 *
 */ 
namespace mashine { namespace utils {

bool is_variable_name(std::string const & variable);

bool is_constant_name(std::string const & constant);

bool is_Literal_name(std::string const & Literal);

bool is_analogy_name(std::string const & analogy);

template <typename _Entity>
std::string vector_to_string(std::vector<_Entity> const & v)
{
	std::string buff;
	
	BOOST_FOREACH(_Entity const & p, v)
	{
		APP_LOGGER(debug) << "!!!" << &p << p.toString() ;
		
		buff.append( p.toString() );
		buff.append( ", " );
	}
	
	if (v.size() != 0) 
	{
		buff.erase(buff.size() - 2, 2);
    }
	
	APP_LOGGER(debug) << "!!!" ;
	
	return buff;
}

template <typename _Entity>
std::string vector_of_ptr_to_string(std::vector<_Entity *> const & v)
{
	std::string buff;
	
	BOOST_FOREACH(_Entity * p, v)
	{
		buff.append( p->toString() );
		buff.append( ", " );
	}
	
	if (v.size() != 0) 
	{
		buff.erase(buff.size() - 2, 2);
    }
	
	return buff;
}

// std::string map_to_string(std::map<std::string, std::string> const & m)
// {
	// std::string buff;

	// std::map<std::string, std::string>::const_iterator i;
	
	// for (i = m.begin(); i != m.end(); ++i)
	// {
		// buff.append((*i).first);
		// buff.append(":");
		// buff.append((*i).second);
		// buff.append(", ");
	// }
	
	// if (m.size() != 0) 
	// {
		// buff.erase(buff.size() - 2, 2);
    // }
	
	// return buff;
// }

std::string vector_of_map_to_string(std::vector<std::map<std::string, std::string> > const & v);

}}

#endif